<?php
class PostsViewModel extends Model
{
	protected $viewModel = true;
	 
	// 视图模型中的字段定义 
	protected $viewFields = array( 
		"Posts"=>array("ID","post_date","post_title","top","post_name","post_type","comment_count","comment_status"),
		"Category"=>array("cid","name","slug")
	); 

	// 视图关联的where条件 
	protected $viewCondition = array(
		"Posts.post_category" => array("eqf","Category.cid")
	);
	
	// 视图模型的主键
	Public function getPk() { 
		return "Posts.ID"; 
	}
}
?>